package com.crm.controller.lnz;

import com.crm.pojo.CrmContract;
import com.crm.pojo.CrmContractType;
import com.crm.utils.R;
import com.crm.vo.AdvancedContract;
import com.crm.vo.Appendix;
import com.crm.vo.Contract;
import com.crm.vo.RenewalRecord;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/contract")
@Api(value = "合同管理的所有操作测试",tags = "合同管理接口API")
public class ContractController {

    /**
     * 查询所有合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryAllContracts",method = RequestMethod.GET)
    @ApiOperation(value = "查询所有合同列表接口",notes = "查询所有合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryAllContracts(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }

    /**
     * 查询今日新增的合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryContractsByToday",method = RequestMethod.GET)
    @ApiOperation(value = "查询今日新增的合同列表接口",notes = "查询今日新增的合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractsByToday(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }

    /**
     * 查询本周新增的合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryContractsByWeek",method = RequestMethod.GET)
    @ApiOperation(value = "查询本周新增的合同列表接口",notes = "查询本周新增的合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractsByWeek(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }


    /**
     * 查询本月新增的合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryContractsByMonth",method = RequestMethod.GET)
    @ApiOperation(value = "查询本月新增的合同列表接口",notes = "查询本月新增的合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractsByMonth(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }


    /**
     * 查询今日到期的合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryContractsByDueToday",method = RequestMethod.GET)
    @ApiOperation(value = "查询今日到期的合同列表接口",notes = "查询今日到期的合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractsByDueToday(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }

    /**
     * 查询本周到期的合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryContractsByDueWeek",method = RequestMethod.GET)
    @ApiOperation(value = "查询本周到期的合同列表接口",notes = "查询本周到期的合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractsByDueWeek(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }

    /**
     * 查询本月到期的合同列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryContractsByDueMonth",method = RequestMethod.GET)
    @ApiOperation(value = "查询本月到期的合同列表接口",notes = "查询本月到期的合同列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractsByDueMonth(int currentPage,int pageSize){
        Contract contract1 = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        Contract contract2 = new Contract(2,1001,"李四",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","李海",new Date(),new Date(),"李健",0);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }

    /**
     * 新增合同
     * @param contract
     * @return
     */
    @RequestMapping(value = "/addContract",method = RequestMethod.POST)
    @ApiOperation(value = "新增合同接口",notes = "新增合同信息",httpMethod = "POST",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R addContract(@RequestBody @ApiParam(name = "contract",value = "合同信息",required = true) Contract contract){
        R r = new R();
        r.setCode(200);
        r.setMsg("添加成功！");
        return r;
    }

    /**
     * 按条件（客户名称、手机号码、合同编号）搜索合同列表
     * @param condition
     * @return
     */
    @RequestMapping(value = "/queryContractByCondition",method = RequestMethod.GET)
    @ApiOperation(value = "按条件（客户名称、手机号码、合同编号）搜索合同列表接口",notes = "按条件（客户名称、手机号码、合同编号）搜索合同列表进行显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "condition",value = "查询条件（客户名称、手机号码、合同编号）",required = true,dataType = "object",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractByCondition(Object condition){
        Contract contract = new Contract(1,1001,"张三",10001,"租赁",new Date(),new Date(), BigDecimal.valueOf(598.11),
                BigDecimal.valueOf(598.11),BigDecimal.valueOf(0),"待审","是","是","无","张杨",new Date(),new Date(),"张平",0);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功！");
        r.setData(contract);
        return r;
    }

    /**
     * 高级搜索合同列表
     * @param advancedContract
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/advancedQueryContracts",method = RequestMethod.GET)
    @ApiOperation(value = "高级搜索合同列表接口",notes = "高级搜索合同列表进行显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R advancedQueryContracts(@RequestBody @ApiParam(name = "advancedContract",value = "高级搜索合同的条件信息",required = true) AdvancedContract advancedContract,int currentPage,int pageSize){
        AdvancedContract contract1 = new AdvancedContract(1,1001,"张三","xxx",new Date(),new Date(),"xxx","否","是","李四",new Date(),"无");
        AdvancedContract contract2 = new AdvancedContract(1,1001,"张三","xxx",new Date(),new Date(),"xxx","否","是","王五",new Date(),"无");
        List<AdvancedContract> contractList = new ArrayList<>();
        contractList.add(contract1);
        contractList.add(contract2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(contractList);
        return r;
    }

    /**
     * 新增合同类型
     * @param crmContractType
     * @return
     */
    @RequestMapping(value = "/addContractType",method = RequestMethod.POST)
    @ApiOperation(value = "新增合同类型接口",notes = "新增合同类型信息",httpMethod = "POST",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R addContractType(@RequestBody @ApiParam(name = "crmContractType",value = "合同类型信息",required = true) CrmContractType crmContractType){
        R r = new R();
        r.setCode(200);
        r.setMsg("添加成功！");
        return r;
    }

    /**
     * 查询合同类型
     * @return
     */
    @RequestMapping(value = "/queryContractTypes",method = RequestMethod.GET)
    @ApiOperation(value = "查询合同类型接口",notes = "查询合同类型信息",httpMethod = "GET",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryContractTypes(){
        CrmContractType crmContractType1 = new CrmContractType(1,"租赁");
        CrmContractType crmContractType2 = new CrmContractType(2,"工程");
        CrmContractType crmContractType3 = new CrmContractType(3,"买卖");
        List<CrmContractType> crmContractTypeList = new ArrayList<>();
        crmContractTypeList.add(crmContractType1);
        crmContractTypeList.add(crmContractType2);
        crmContractTypeList.add(crmContractType3);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功！");
        r.setData(crmContractTypeList);
        return r;
    }

    /**
     * 修改合同类型
     * @param crmContractType
     * @return
     */
    @RequestMapping(value = "/updateContractType",method = RequestMethod.POST)
    @ApiOperation(value = "修改合同类型接口",notes = "修改合同类型信息",httpMethod = "POST",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R updateContractType(@RequestBody @ApiParam(name = "crmContractType",value = "合同类型信息",required = true) CrmContractType crmContractType){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功！");
        return r;
    }

    /**
     * 删除合同类型
     * @param id
     * @return
     */
    @RequestMapping(value = "/deleteContractType",method = RequestMethod.POST)
    @ApiOperation(value = "删除合同类型接口",notes = "删除合同类型",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "合同类型编号",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R deleteContractType(int id){
        R r = new R();
        r.setCode(200);
        r.setMsg("删除成功！");
        return r;
    }

    /**
     * 新增合同续费记录
     * @param renewalRecord
     * @return
     */
    @RequestMapping(value = "/addRenewal",method = RequestMethod.POST)
    @ApiOperation(value = "新增合同续费接口",notes = "新增合同续费信息",httpMethod = "POST",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R addRenewal(@RequestBody @ApiParam(name = "renewalRecord",value = "续费信息",required = true) RenewalRecord renewalRecord){
        R r = new R();
        r.setCode(200);
        r.setMsg("添加成功！");
        return r;
    }

    /**
     * 修改合同续费记录
     * @param renewalRecord
     * @return
     */
    @RequestMapping(value = "/updateRenewal",method = RequestMethod.POST)
    @ApiOperation(value = "修改合同续费接口",notes = "修改合同续费信息",httpMethod = "POST",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R updateRenewal(@RequestBody @ApiParam(name = "renewalRecord",value = "续费信息",required = true) RenewalRecord renewalRecord){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功！");
        return r;
    }

    /**
     * 删除合同续费记录
     * @param id
     * @return
     */
    @RequestMapping(value = "/deleteRenewal",method = RequestMethod.POST)
    @ApiOperation(value = "删除续费接口",notes = "删除续费信息",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "续费记录编号",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R deleteRenewal(int id){
        R r = new R();
        r.setCode(200);
        r.setMsg("删除成功！");
        return r;
    }

    /**
     * 修改续费状态
     * @param id
     * @param status
     * @return
     */
    @RequestMapping(value = "/updateRenewalStatus",method = RequestMethod.POST)
    @ApiOperation(value = "修改续费状态接口",notes = "修改续费状态",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "续费记录编号",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "status",value = "续费记录要修改状态",required = true,dataType = "string",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R updateRenewalStatus(int id,String status){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功！");
        return r;
    }

    /**
     * 查询续费记录
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryRenewals",method = RequestMethod.GET)
    @ApiOperation(value = "查询续费记录接口",notes = "查询续费记录进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryRenewals(int currentPage,int pageSize){
        RenewalRecord renewalRecord1 = new RenewalRecord(1,"第1次续费",1001,new Date(),new Date(),BigDecimal.valueOf(345.90),BigDecimal.valueOf(200.90),
                new Date(),BigDecimal.valueOf(445.90),BigDecimal.valueOf(223.90),"无","张三");
        RenewalRecord renewalRecord2 = new RenewalRecord(2,"第2次续费",1001,new Date(),new Date(),BigDecimal.valueOf(345.90),BigDecimal.valueOf(200.90),
                new Date(),BigDecimal.valueOf(445.90),BigDecimal.valueOf(223.90),"无","李四");
        List<RenewalRecord> renewalRecordList = new ArrayList<>();
        renewalRecordList.add(renewalRecord1);
        renewalRecordList.add(renewalRecord2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功！");
        r.setData(renewalRecordList);
        return r;
    }

    /**
     * 到款
     * @param id
     * @param payment
     * @param remark
     * @return
     */
    @RequestMapping(value = "/paymentReceived",method = RequestMethod.POST)
    @ApiOperation(value = "到款接口",notes = "到款",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "合同编号",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "payment",value = "到款金额",required = true,dataType = "string",paramType = "query"),
            @ApiImplicitParam(name = "remark",value = "备注",required = true,dataType = "string",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R paymentReceived(int id,String payment,String remark){
        R r = new R();
        r.setCode(200);
        r.setMsg("到款成功！");
        return r;
    }

    /**
     * 修改合同
     * @param contract
     * @return
     */
    @RequestMapping(value = "/updateContract",method = RequestMethod.POST)
    @ApiOperation(value = "修改合同接口",notes = "修改合同信息",httpMethod = "POST",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R updateContract(@RequestBody @ApiParam(name = "contract",value = "合同信息",required = true) Contract contract){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功！");
        return r;
    }

    /**
     * 删除合同记录
     * @param id
     * @return
     */
    @RequestMapping(value = "/deleteContract",method = RequestMethod.POST)
    @ApiOperation(value = "删除合同接口",notes = "删除合同信息",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "合同编号",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R deleteContract(int id){
        R r = new R();
        r.setCode(200);
        r.setMsg("删除成功！");
        return r;
    }

    /**
     * 修改合同状态
     * @param id
     * @param status
     * @return
     */
    @RequestMapping(value = "/updateContractStatus",method = RequestMethod.POST)
    @ApiOperation(value = "修改合同状态接口",notes = "修改合同状态",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "合同编号",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "status",value = "合同要修改状态",required = true,dataType = "string",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R updateContractStatus(int id,String status){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功！");
        return r;
    }

    /**
     * 查询文件列表
     * @param contractId
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryFile",method = RequestMethod.GET)
    @ApiOperation(value = "查询文件列表接口",notes = "查询文件列表进行分页显示",httpMethod = "GET",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractId",value = "合同编号",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryFile(int contractId,int currentPage,int pageSize){
        Appendix appendix1 = new Appendix(1,"xxxxx.jpg",12.5,"xxxxxx","无","张三",
                new Date(),"合同",1,1);
        Appendix appendix2 = new Appendix(2,"xxxxx.jpg",12.5,"xxxxxx","无","李四",
                new Date(),"合同",1,1);
        List<Appendix> appendixList = new ArrayList<>();
        appendixList.add(appendix1);
        appendixList.add(appendix2);
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(appendixList);
        return r;
    }

    /**
     * 上传文件
     * @param file
     * @param appendixRemark
     * @param employeeId
     * @param contractId
     * @return
     */
    @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
    @ApiOperation(value = "上传文件接口",notes = "上传文件",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file",value = "文件",required = true,dataType = "file",paramType = "query"),
            @ApiImplicitParam(name = "appendixRemark",value = "备注",required = true,dataType = "string",paramType = "query"),
            @ApiImplicitParam(name = "contractId",value = "合同编号",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "employeeId",value = "业务员编号",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R uploadFile(MultipartFile file,String appendixRemark,int employeeId,int contractId){
        R r = new R();
        r.setCode(200);
        r.setMsg("上传成功");
        return r;
    }

    /**
     * 下载文件
     * @param id
     * @return
     */
    @RequestMapping(value = "/downloadFile",method = RequestMethod.POST)
    @ApiOperation(value = "下载文件接口",notes = "下载文件",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "文件编号",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R downloadFile(int id){
        R r = new R();
        r.setCode(200);
        r.setMsg("下载成功");
        return r;
    }

    /**
     * 删除文件
     * @param id
     * @return
     */
    @RequestMapping(value = "/deleteFile",method = RequestMethod.POST)
    @ApiOperation(value = "删除文件接口",notes = "删除文件",httpMethod = "POST",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "文件编号",required = true,dataType = "int",paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R deleteFile(int id){
        R r = new R();
        r.setCode(200);
        r.setMsg("下载成功");
        return r;
    }
}
